package com.heihx.api.client;

import com.heihx.dto.GoodsSalesDTO;
import com.heihx.result.Result;
import io.swagger.v3.oas.annotations.Operation;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;

import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.util.List;

@FeignClient("order-service")
public interface OrderClient {
    /**
     * 统计订单
     * @param begin
     * @param end
     * @param status
     * @return
     */
    @GetMapping("/admin/order/countByMap")
    @Operation(summary = "统计订单")
    Result<Long> countOrders(@RequestParam(value = "begin") LocalDateTime begin,
                             @RequestParam(value = "end") LocalDateTime end,
                             @RequestParam(value = "status") Integer status);

    /**
     * 统计订单金额
     * @param begin
     * @param end
     * @param status
     * @return
     */
    @GetMapping("/admin/order/sumByMap")
    @Operation(summary = "统计订单金额")
    Result<BigDecimal> sumOrders(@RequestParam(value = "begin") LocalDateTime begin,
                                 @RequestParam(value = "end") LocalDateTime end,
                                 @RequestParam(value = "status") Integer status);

    /**
     * 查询销量top10
     * @param begin
     * @param end
     * @return
     */
    @GetMapping("/admin/order/top10")
    @Operation(summary = "查询销量top10")
    Result<List<GoodsSalesDTO>> top10(@RequestParam(value = "begin") LocalDateTime begin,
                                      @RequestParam(value = "end") LocalDateTime end);
}
